home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / gawk / cawf2st.zoo / cawf.h < prev    next >
C/C++ Source or Header  |  1992-04-12  |  12KB  |  259 lines

  1. /*
  2.  *      cawf.h - definitions for cawf(1)
  3.  */
  4.  
  5. /*
  6.  *      Copyright (c) 1991 Purdue University Research Foundation,
  7.  *      West Lafayette, Indiana 47907.  All rights reserved.
  8.  *
  9.  *      Written by Victor A. Abell <abe@mace.cc.purdue.edu>,  Purdue
  10.  *      University Computing Center.  Not derived from licensed software;
  11.  *      derived from awf(1) by Henry Spencer of the University of Toronto.
  12.  *
  13.  *      Permission is granted to anyone to use this software for any
  14.  *      purpose on any computer system, and to alter it and redistribute
  15.  *      it freely, subject to the following restrictions:
  16.  *
  17.  *      1. The author is not responsible for any consequences of use of
  18.  *         this software, even if they arise from flaws in it.
  19.  *
  20.  *      2. The origin of this software must not be misrepresented, either
  21.  *         by explicit claim or by omission.  Credits must appear in the
  22.  *         documentation.
  23.  *
  24.  *      3. Altered versions must be plainly marked as such, and must not
  25.  *         be misrepresented as being the original software.  Credits must
  26.  *         appear in the documentation.
  27.  *
  28.  *      4. This notice may not be removed or altered.
  29.  */
  30.  
  31. #include <stdio.h>
  32. #ifdef  STDLIB
  33. #include <stdlib.h>
  34. #endif
  35. #ifdef  UNIX
  36. #include <sys/types.h>
  37. #else
  38. #include <sys\types.h>
  39. #endif
  40. #include "regexp.h"
  41. #include "cawflib.h"
  42.  
  43. #define ESC             '\033'                  /* ESCape character */
  44. #define MAXEXP          30                      /* maximum expressions
  45.                                                  * (and TABs) */
  46. #define MAXFILES        10                      /* maximum files (including
  47.                                                  * *.dev, common and *.mac) */
  48. #define MAXFSTK         5                       /* maximum file stack
  49.                                                  * (for .so) */
  50. #define MAXHYCH         10                      /* maximum hyphen characters */
  51. #define MAXLINE         256                     /* maximum line length */
  52. #define MAXMACRO        100                     /* maximum number of macros */
  53. #define MAXMTXT         1024                    /* maximum macro text lines */
  54. #define MAXNHNR         10                      /* maximum ".NH" numbers
  55.                                                  * (but 0 not used) */
  56. #define MAXNR           50                      /* maximum number reg */
  57. #define MAXOLL          512                     /* maximum output line length */
  58. #define MAXSCH          256                     /* maximum special characters */
  59. #define MAXSP           25                      /* maximum stack pointer (for
  60.                                                  * nesting of macro calls) */
  61. #define MAXSTR          100                     /* maximum ".ds" strings */
  62.  
  63. /*
  64.  * Output line adjustment modes
  65.  */
  66.  
  67. #define LEFTADJ         0
  68. #define RIGHTADJ        1
  69. #define BOTHADJ         2
  70.  
  71. /*
  72.  * Error handling codes
  73.  */
  74.  
  75. #define FATAL           0                       /* fatal error */
  76. #define LINE            0                       /* display line */
  77. #define NOLINE          1                       /* don't display line */
  78. #define WARN            1                       /* warning error */
  79.  
  80. /*
  81.  * Padding directions
  82.  */
  83.  
  84. #define PADLEFT         0                       /* pad from left */
  85. #define PADRIGHT        1                       /* pad from right */
  86.  
  87. /*
  88.  * Pass 3 signal codes
  89.  */
  90.  
  91. #define NOBREAK         -1
  92. #define DOBREAK         -2
  93. #define MESSAGE         -3
  94.  
  95. /*
  96.  * Macro argument types
  97.  */
  98.  
  99. #define MANMACROS       1                       /* -man */
  100. #define MSMACROS        2                       /* -ms */
  101.  
  102.  
  103. struct fcode {
  104.         char nm;                        /* font name character */
  105.         char status;                    /* status */
  106. };
  107.  
  108. struct hytab {
  109.         char font;                      /* font name character */
  110.         int len;                        /* effective length */
  111.         char *str;                      /* value string */
  112. };
  113.  
  114. struct macro {
  115.         char name[2];                   /* macro name */
  116.         int bx;                         /* beginning Macrotxt[] index */
  117.         int ct;                         /* index count */
  118. };
  119.  
  120. struct nbr {
  121.         char nm[2];                     /* register name */
  122.         int val;                        /* value */
  123. };
  124.  
  125. struct parms {
  126.         char nm[2];                     /* parameter name */
  127.         char *cmd;                      /* pass 3 command */
  128.         int val;                        /* current value */
  129.         int prev;                       /* previous value */
  130. };
  131.  
  132. struct rx {
  133.         char *re;                       /* regular expression */
  134.         struct regexp *pat;             /* compiled pattern */
  135. };
  136.  
  137. struct scale {
  138.         char nm;                        /* scale factor name */
  139.         double val;                     /* value */
  140. };
  141.  
  142. struct schtab {
  143.         char nm[2];                     /* character name */
  144.         int len;                        /* effective length */
  145.         char *str;                      /* value string */
  146. };
  147.  
  148. struct str {
  149.         char nm[2];                     /* string name */
  150.         char *str;                      /* string value */
  151. };
  152.  
  153. extern int Adj;                         /* output line adjustment mode */
  154. extern char *Aftnxt;                    /* action after next line */
  155. extern char *Args[];                    /* macro arguments */
  156. extern char *Argstack[];                /* stack for Expand()'s "args[]" */
  157. extern int Backc;                       /* last word ended with '\\c' */
  158. extern int Botmarg;                     /* bottom margin */
  159. extern int Centering;                   /* centering count */
  160. extern int Condstack[];                 /* stack for Expand()'s "cond" */
  161. extern char *Cont;                      /* continue line append */
  162. extern int Contlen;                     /* continue line append length */
  163. extern int Curmx;                       /* current macro name */
  164. extern int Divert;                      /* diversion status */
  165. extern FILE *Efs;                       /* error file stream pointer */
  166. extern char *Eol;                       /* end of line information */
  167. extern int Eollen;                      /* end of line length */
  168. extern int Err;                         /* error flag */
  169. extern char *F;                         /* field value */
  170. extern struct fcode Fcode[];            /* font codes */
  171. extern int Fill;                        /* fill status */
  172. extern char Font[];                     /* current font */
  173. extern char Fontout;                    /* font output mode */
  174. extern int Fph;                         /* first page header status */
  175. extern int Fsp;                         /* files stack pointer (for .so) */
  176. extern char *Ftc;                       /* center footer */
  177. extern char *Ftl;                       /* left footer */
  178. extern char *Ftr;                       /* right footer */
  179. extern char *Hdc;                       /* center header */
  180. extern int Hdft;                        /* header/footer status */
  181. extern char *Hdl;                       /* left header */
  182. extern char *Hdr;                       /* right header */
  183. extern FILE *Ifs;                       /* input file stream */
  184. extern FILE *Ifs_stk[];                 /* Ifs stack */
  185. extern int Ind;                         /* indentation amount */
  186. extern char *Inname;                    /* input file name */
  187. extern char *Inn_stk[];                 /* Inname stack */
  188. extern struct hytab Hychar[];           /* hyphen characters */
  189. extern int LL;                          /* line length */
  190. extern char Line[];                     /* input line */
  191. extern int Lockil;                      /* pass 2 line number is locked
  192.                                          * (processing is inside macro) */
  193. extern int Marg;                        /* macro argument - man, ms, etc. */
  194. extern struct macro Macrotab[];         /* macro table */
  195. extern int Macrostack[];                /* stack for Expand()'s "macro" */
  196. extern char *Macrotxt[];                /* macro text */
  197. extern int Mtx;                         /* macro text index */
  198. extern int Mxstack[];                   /* stack for Expand()'s "mx" */
  199. extern int Nhnr[];